Copyright: Text (c)1995 G.Bamber
Citation: Authored by G.Bamber (c)1995


Contents
GBLIB1c.DLL - A utility library for Visual Basic Programmers

By Gordon Bamber (c)May1995

 (or ALT+x)

 Overview of GBLIB1c.DLL

 GBLIB1c.DLL Complete Function Reference

GBLIB1c.DLL Function Reference by Category

System requirements for using/distributing GBLIB1c.DLL

 About GBLIB1c.DLL

 Future changes and updates

 Whats new from GBLIB1a?


Contents

Index of all Subs and Functions in GBLIB1c.DLL

 (or ALT+x)

Click the sub or function name to obtain more information

Sub About 	index 1

Function PlayDLLWave 	index 2

Function LoadDLLBitmap 	index 3

Function GetDLLText 	index 4

Function GetDLLBitmapSize 	index 5

Function LoadDLLBitmapTo 	index 6

Function PlayResource 	index 7

Sub Gordon 	index 8

Sub Marts 	index 9

Sub PlayLoop 	index 10

Sub StopLoop 	index 11

Sub Clik 	index 12

Sub Click 	index 13

Sub Done 	index 14

Sub SystemStart 	index 15

Sub SystemEnd 	index 16

Sub SystemBeep 	index 17

Sub SystemQuestion 	index 18

Sub SystemExclamation 	Index 19

Sub SystemAsterisk 	index 20

Sub SystemHand 	index 21

Sub MouseClick 	index 22

Sub ProgramLaunch 	index 23

Sub PlaySound 	index 24

LoadDLLBitmapFrom 	index 25

LoadDLLDialog 	index 26

LoadDLLIcon 	index 27

LoadDLLCursor 	index 28

DestroyDLLCursor 	index 29

SetArrow 	index 30

GBSetCursorPos 	index 31

GBClientToScreenRECT 	index 32

GBDecompress 	index 33

GBPutOnTop 	index 34

GBNotOnTop 	index 35

ModalCalc 	index 36

ModalNotePad 	index 37

ModalNotePadExec 	index 38

MakeUAE 	index 39

WaitForL 	index 40

WaitFor 	index 41

SpeakerBeep 	index 42

StartWait 	index 43

StopWait 	index 44

WaitOne 	index 45

LoadEXEIcon 	index 46

SubClassIt 	index 47

UnSubClassIt 	index 48

LoadEXEIconXY 	index 49

LoadDLLIconXY 	index 50

SetUpJoystick 	index 51

UnSetUpJoyStick 	index 52

WillPlay811Mono 	index 53

WillPlay811Stereo 	index 54

WillPlay1611Mono 	index 55

WillPlay1611Stereo 	index 56

WillPlay822Mono 	index 57

WillPlay822Stereo 	index 58

WillPlay1622Mono 	index 59

WillPlay1622Stereo 	index 60

WillPlay844Mono 	index 61

WillPlay844Stereo 	index 62

WillPlay1644Mono 	index 63

WillPlay1644Stereo 	index 64

GetWaveVendorID 	index 65

GetWaveProductID 	Index 66

GetWaveDriverVersion 	Index 67

GetWaveProductName 	Index 68

GetWaveNumChannels 	Index 69

GetMIDIVendorID 	index 70

GetMIDIProductID 	Index 71

GetMIDIDriverVersion 	Index 72

GetMIDIProductName 	Index 73

GetMIDIVoices 	Index 74

GetMIDINotes 	Index 75

GetMIDINumChannels 	Index 76

IsMIDI 	Index 77

IsMIDISquareWaveSynth 	Index 78

IsMIDIFMSynth 	Index 79

IsMIDIGenericSynth 	Index 80

IsMIDIMapper 	Index 81

WillMidiDoVolume 	Index 82

WillMidiDoLRVolume 	Index 83

WillMidiDoCache 	Index 84

PlayDLLWaveExt 	Index 85

GBGetDiskSizeS 	Index 86

GBGetDiskSizeL 	Index 87

GBGetDiskFreeS 	Index 88

GBGetDiskFreeL 	Index 89

GBIsFileInPath 	Index 90

EncodeSingle 	Index 91

DecodeSingle 	Index 92

InstallAFont 	Index 93

GetNumColours 	Index 95

DisableMouse 	Index 96

EnableMouse 	Index 97

GetJoyPos 	Index 98

RegisterAppExt 	Index 99

RegisterAppPrintExt 	Index 100

UnRegisterAppExt  	Index 101

UnRegisterAppPrintExt 	Index 102

UnRegisterAll 	Index 103

See...	Functions By Category


About GBLIB1.DLL

About GBLIB1c.DLL

 (or ALT+x)

GBLIB1c.DLL (c)1994 was written in Borland Turbo Pascal for Windows(tm) V1.5 by The Author .

It is released as FREEWARE on the following conditions:

1)  Copyright remains with the author.

2)  Commercial use is prohibited without the author"s written permission.

3)  No responsibility is accepted by the author for support in its use.

4)  No responsibility is accepted under any circumstances by the author for any damage caused in its use.

5)  Subject to conditions (1) to (4), you may use it in any way you please.

6)  There is to be no condition (7)

8)  Source code for GBLIB1c.DLL is not freeware.


PlayResource

Function PlayResource

 (or ALT+x)

Purpose

There are a number of WAVES  already embedded in GBLIB1c.DLL.. They can be called by their own subroutines (ie. Sub Click ) or using this function.

The embedded sounds are:

GORDON	Me  saying "Hello"

MARTS	A collegue (Martin Pointer) saying "Hello"

CLICK	A sound like a camera shutter

CLIK	A shorter and harder version of CLICK (Click with a flick-knife)

DONE	A man saying Done Processing

GBLIB1c.DLL Pascal Prototype

Function PlayResource(lpname:LPSTR):INT

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","PlayResource","i=S")

PlayResource("DONE")

Visual Basic Declare

Declare Function PlayResource Lib "GBLIB1c.DLL" (ByVal szResName As String) as Integer

Visual Basic Example

i_Retval = PlayResource ("CLICK")

See...	PlaySound 	SpeakerBeep


Sub About

Subs About, AboutHelp

 (or ALT+x)

CLICK ME for an example of AboutHelp

Purpose

An about screen for GBLIB1c.DLL. You have no compulsion to include this in your application if it uses GBLIB1c.DLL, but I would consider you a complete asshole if you didn"t.

GBLIB1c.DLL Pascal Prototype

Procedure About(hWind:UINT)

Procedure AboutHelp

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","AboutHelp","v=")

AboutHelp()

Visual Basic Declares

Declare Sub About Lib "GBLIB1c.DLL" (ByVal i_HWnd As Integer)

Declare Sub AboutHelp Lib "GBLIB1c.DLL" ()

Visual Basic Examples

About Me.hWnd

AboutHelp

See...	About GBLIB1 	LoadDLLDialog


Sub Gordon

 (or ALT+x)

Purpose

Me  saying "Hello".

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure Gordon

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","Gordon","v=")

Gordon()

Visual Basic Declare

Declare Sub Gordon Lib "GBLIB1c.DLL" ()

Visual Basic Example

 Gordon

See...	About


Sub Marts

 (or ALT+x)

Purpose

Martin Pointer saying "Hello". (Who the heck is Martin Pointer?)

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure Marts

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","Marts","v=")

Marts()

Visual Basic Declare

 Declare Sub Marts Lib "GBLIB1c.DLL" ()

Visual Basic Example

 Marts

See...	PlayResource


Sub StopLoop

 (or ALT+x)

Purpose

Plays a NULL sound, which has the effect of stopping any sound started by calling the PlayLoop  sub. No sound is produced by StopLoop itself.

CLICK ME to start a looped sound as an example.

CLICK ME to stop looping

GBLIB1c.DLL Pascal Prototype

Procedure StopLoop

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","StopLoop","v=")

StopLoop()

Visual Basic Declare

Declare Sub StopLoop Lib "GBLIB1c.DLL" ()

Visual Basic Example

StopLoop

See...	PlayLoop 	PlaySound


Sub PlayLoop

 (or ALT+x)

Purpose

Plays the specified WAVE  repeatedly until another wave is played, or StopLoop  is called.

CLICK ME to start a looped sound as an example.

CLICK ME to stop looping

GBLIB1c.DLL Pascal Prototype

Procedure PlayLoop(sz_WAVFile:LPSTR)

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","PlayLoop","i=S")

PlayLoop("c:\windows\snore.wav")

Visual Basic Declare

Declare Sub PlayLoop Lib "GBLIB1c.DLL" ( ByVal szWAVEFile as string )

Visual Basic Example

PlayLoop "c:\windows\snore.wav"

See...	StopLoop 	PlaySound


Sub Clik

 (or ALT+x)

Purpose

Plays a short click sound. - Good for menu selections.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure Clik

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","Clik","v=")

Clik()

Visual Basic Declare

Declare Sub Clik Lib "GBLIB1c.DLL" ()

Visual Basic Example

Clik

See...	SpeakerBeep 	PlaySound 	Click


Sub Click

 (or ALT+x)

Purpose

Plays a camera shutter click sound. - Good for command buttons.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure Click

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","Click","v=")

Click()

Visual Basic Declare

Declare Sub Click Lib "GBLIB1c.DLL" ()

Visual Basic Example

Click

See...	Clik 	SpeakerBeep 	PlaySound


Sub Done

 (or ALT+x)

Purpose

Plays the sound of a man saying "Done Processing"  I like this sound. I would love to hear the same person saying something like "Please can I go to the toilet? " or "Hi - pleased to meet you - havn"t I got a silly voice? "

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure Done

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","Done","v=")

Done()

Visual Basic Declare

Declare Sub Done Lib "GBLIB1c.DLL" ()

Visual Basic Example

Done

See...	PlayResource


Sub SystemStart

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

SystemStart=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemStart

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemStart","v=")

SystemStart()

Visual Basic Declare

Declare Sub SystemStart Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemStart

See...	SystemEnd 	SystemBeep 	SystemAsterisk
SystemHand 	SystemQuestion 	SystemExclamation
MouseClick 	ProgramLaunch 	PlaySound


Sub SystemEnd

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI  file under

[Sounds]

SystemEnd=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemEnd

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemEnd","v=")

SystemEnd()

Visual Basic Declare

Declare Sub SystemEnd Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemEnd

See...	SystemStart 	SystemBeep 	SystemAsterisk
SystemHand 	SystemQuestion 	SystemExclamation
MouseClick 	ProgramLaunch 	PlaySound


Sub SystemBeep

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

SystemBeep=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemBeep

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemBeep","v=")

SystemBeep()

Visual Basic Declare

Declare Sub SystemBeep Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemBeep

See...	SystemEnd 	SystemStart 	SystemAsterisk
SystemHand 	SystemQuestion 	SystemExclamation
MouseClick 	ProgramLaunch 	PlaySound


Sub SystemQuestion

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

SystemQuestion=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemQuestion

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemQuestion","v=")

SystemQuestion()

Visual Basic Declare

Declare Sub SystemQuestion Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemQuestion

See...	SystemEnd 	SystemStart 	SystemAsterisk
SystemHand 	SystemBeep 	SystemExclamation
MouseClick 	ProgramLaunch 	PlaySound


Sub SystemExclamation

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

SystemExclamation=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemExclamation

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemExclamation","v=")

SystemExclamation()

Visual Basic Declare

Declare Sub SystemExclamation Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemExclamation

See...	SystemEnd 	SystemStart 	SystemAsterisk
SystemHand 	SystemBeep 	SystemQuestion
MouseClick 	ProgramLaunch 	PlaySound


Sub SystemAsterisk

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

SystemAsterisk=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemAsterisk

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemAsterisk","v=")

SystemAsterisk()

Visual Basic Declare

Declare Sub SystemAsterisk Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemAsterisk

See...	SystemEnd 	SystemStart 	SystemExclamation
SystemHand 	SystemBeep 	SystemQuestion
MouseClick 	ProgramLaunch 	PlaySound


Sub SystemHand

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

SystemHand=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SystemHand

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","SystemHand","v=")

SystemHand()

Visual Basic Declare

Declare Sub SystemHand Lib "GBLIB1c.DLL" ()

Visual Basic Example

SystemHand

See...	SystemEnd 	SystemStart 	SystemExclamation
SystemAsterisk 	SystemBeep 	SystemQuestion
MouseClick 	ProgramLaunch 	PlaySound


Sub MouseClick

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

MouseClick=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure MouseClick

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","MouseClick","v=")

MouseClick()

Visual Basic Declare

Declare Sub MouseClick Lib "GBLIB1c.DLL" ()

Visual Basic Example

MouseClick

See...	SystemEnd 	SystemStart 	SystemExclamation
SystemAsterisk 	SubSystemBeep 	SystemQuestion
SystemHand 	SubProgramLaunch 	PlaySound


Sub ProgramLaunch

 (or ALT+x)

Purpose

Plays the sound specified in your WIN.INI under

[Sounds]

ProgramLaunch=

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure ProgramLaunch

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","ProgramLaunch","v=")

ProgramLaunch()

Visual Basic Declare

Declare Sub ProgramLaunch Lib "GBLIB1c.DLL" ()

Visual Basic Example

ProgramLaunch

See...	SystemEnd 	SystemStart 	SystemExclamation
SystemAsterisk 	SubSystemBeep 	SystemQuestion
SystemHand 	MouseClick 	PlaySound


Sub PlaySound

 (or ALT+x)

Purpose

Plays a WAV file  from disk.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure PlaySound(sz_WAVFile:LPSTR)

Help Declare and Use

RegisterRoutine("GBLIB1c.DLL","PlaySound","v=S")

PlaySound("c:\windows\tada.wav")

Visual Basic Declare

Declare Sub PlaySound Lib "GBLIB1c.DLL" ( ByVal sz_WAVFile as String)

Visual Basic Example

PlaySound "c:\windows\sparkle.wav"

See...	SystemEnd 	SystemStart 	SystemExclamation
SystemAsterisk 	SystemBeep 	SystemQuestion
SystemHand 	MouseClick 	ProgramLaunch


Function PlayDLLWave

 (or ALT+x)

Purpose

This function will play a user resource of type WAVE

Returns	Zero=Success, NonZero=Failure

GBLIB1c.DLL Pascal Prototype

Function PlayDLLWave (sz_Filename, sz_ResName :LPSTR) :INT

Visual Basic Declare

Declare Function PlayDLLWave Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_WAVEName As String) As Integer

Visual Basic Example

Dim i_Retval as integer

Rem	//The sound is in vbres.dll and the resource is named WAVE_1//

i_Retval = PlayDLLWave("c:\windows\vbres.dll", "WAVE_1")

Rem	//If successful, the return value is zero//

If i_Retval Then

    MsgBox "Bad return from PlayDLLWave", 16, "ERROR"

    Exit Sub

End If

See
How to add a non-standard resource to a DLL
PlayDLLWaveExt


Function LoadDLLBitmap

 (or ALT+x)

Purpose

This function will display a Bitmap from a DLL resource into a Form or PictureBox hDC, which can then be assigned to the Picture Property

If Stretch=0 then no resizing

If Stretch=1 then the bitmap resizes to fit the window

Returns

Zero=Success, NonZero=Failure

GBLIB1c.DLL Pascal Prototype

Function LoadDLLBitmap (sz_Resname, sz_Filename :LPSTR; hWind, ThehDC :UINT; Stretch :INT) :INT

Visual Basic Declare

Declare Function LoadDLLBitmap Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_BitMapName As String, ByVal hWnd As Integer, ByVal ThehDC As Integer ByVal Stretch As Integer) As Integer

Visual Basic Example

Rem	//Loading into the Picture Box called pic1//

Call LoadAPicture pic1, "BITMAP_1", 0

Rem	//If the last parameter was 1, then it would AutoSize to Pic1//

Which Calls...

Sub LoadAPicture (c As Control, sz As String, bstretch As Integer)

Dim i_Retval As Integer

Dim hwind As Integer

Dim WindDC As Integer

Rem	//Get the control"s hWnd property//

hwind = c.hWnd

Rem	//Get the control"s hDC property//

WindDC = c.hDC

c.Autoredraw = True

i_Retval = LoadDLLBitmap("c:\windows\vbres.dll", sz, hwind, WindDC, bstretch)

Rem	//Test for failure//

If i_Retval Then

    MsgBox "Returned an error", 16, "LoadDLLBitmap Function"

    Exit Sub

End If

Rem	//Make image permanent//

c.Picture = c.Image

End Sub

See...	LoadDLLBitmapFrom 	LoadDLLBitmapTo


Function GetDLLText

 (or ALT+x)

GBLIB1c.DLL Pascal Prototype

Function GetDLLText (sz_Filename, sz_Resname, sz_Text :LPSTR; Var i_Len :UINT) :INT

Purpose

This function will load a user resource of type TEXT

The text resource must end in ASCII 0

Returns

SZTEXT as a String/LPSTR

SZLEN as the length of szText

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function GetDLLText Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_TextName As String, ByVal lpText As String, iLen As Integer) As Integer

Visual Basic Example

Global Declaration

Rem	//The function requires a fixed length string//

Global lpSzr As String * 512

Typical Use in an event Sub

Dim msg As String

Rem	//Remember the DLL text could include embedded carriage returns//

msg = VBSetTextFromDLL("DLLNAME") & Chr$(13)

msg = msg & "Version " & VBSetTextFromDLL("VERSION") & Chr$(13)

msg = msg & VBSetTextFromDLL("COPYRIGHT")

lbl_OutPut.Caption = msg

Visual Basic Wrapper Function

 Function VBSetTextFromDLL (sz As String) As String

Dim i_Retval As Integer

Dim szlen As Integer

Rem	//Initialise lpSzr to ASCII Zeros//

szlen = 512

lpSzr = String$(512, 0)

i_Retval = GetDLLText("c:\windows\vbres.dll", sz, lpSzr, szlen)

If i_Retval Then

    MsgBox "Bad return from GetDLLText", 16, "ERROR"

    VBSetTextFromDLL = "unknown"

    Exit Function

End If

Rem	//The DLL Text MUST end in an ASCII Zero //

VBSetTextFromDLL = Left$(lpSzr, szlen)

End Function

See	How to add a non-standard resource to a DLL


Function GetDLLBitmapSize

 (or ALT+x)

Purpose

This function will interrogate a Bitmap resource. Used in conjunction with LoadDLLBitmap , for instance, you could resize the VB control to the bitmap"s size before loading it in, and thus use a generic picturebox control to display a series of bitmaps.

Returns

TRECT Structure contains size:

TRECT.Right = Width,

TRECT.Bottom = height

Zero=Success, NonZero=Failure

GBLIB1c.DLL Pascal Prototype

Function GetDLLBitmapSize (sz_Filename, sz_Resname :LPSTR ;Var MyRect :TRECT) :INT

Visual Basic Declare

Rem 	//Declare TRECT before using it in the Function Declare//

Type TRECT

     Left As Integer

     Top As Integer

     Right As Integer

     Bottom As Integer

End Type

Declare Function GetDLLBitmapSize Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal lpname As String, MyRECT As TRECT) As Integer

Visual Basic Example

Dim msg As String

Dim ARECT as TRECT

rem	//TRECT must first be declared as a TYPE prototype//

i_Retval = GetDLLBitmapSize("c:\windows\vbres.dll", "BITMAP_1", ARECT)

If i_Retval Then

    MsgBox "Bad return from GetDLLBitmapSize", 16, "ERROR"

    Exit Sub

End If

rem	//The return values are always in pixels//

msg = Format$(ARECT.Right)

msg = msg & " Pixels x "

msg = msg & Format$(ARECT.Bottom)

msg = msg & " Pixels"

lbl_OutPut.Caption = msg

See...	LoadDLLBitmap 	LoadDLLBitmapFrom 	LoadDLLBitmapTo


Function LoadDLLBitmapTo

 (or ALT+x)

Purpose

This function will display a Bitmap from a DLL resource into a Form or PictureBox. The picture property can then be set to make it permanent.

Left, Top, Right and Bottom place the bitmap RELATIVE TO the Top and Left of the display Window

Returns

Zero=Success, NonZero=Failure

GBLIB1c.DLL Pascal Prototype

Function LoadDLLBitmapTo (sz_Filename, sz_Resname: LPSTR; hWind, WindDC: UINT; Left, Top, Right, Bottom :UINT) :INT

Visual Basic Declare

Declare Function LoadDLLBitmapTo Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_BitMapName As String, ByVal ThehWnd As Integer, ByVal ThehDC As Integer, ByVal i_Left As Integer, ByVal i_Top As Integer, ByVal i_Right As Integer, ByVal i_Bottom As Integer,) As Integer

Visual Basic Example

PictureBox.Autoredraw = True

i_Retval = LoadDLLBitmapTo("c:\windows\vbres.dll", "MYPICTURE", PictureBox.hWnd, PictureBox.hDC, 10,10,200,200)

Rem	//Test for failure//

If i_Retval Then

    MsgBox "Returned an error", 16, "LoadDLLBitmapTo Function"

    Exit Sub

End If

Rem	//Make it permanent//

PictureBox.Picture = PictureBox.Image

End Sub

See...	LoadDLLBitmap 	LoadDLLBitmapFrom


Calling Functions by Index

This Function or Sub can be called by this Index number instead of by name.


Overview of GBLIB1.DLL

Overview of GBLIB1c.DLL

 (or ALT+x)

Aim and Purpose of GBLIB1c.DLL

GBLIB1c.DLL was written as a companion to Visual Basic(tm) V3.0.

There were 2 criteria for including a function or subroutine in the library.

Either:	1) Visual Basic was unable to do it.

or 	2) It saved tedious and/or complicated API declarations.

In category (1) are the SubClassing and Cursor functions.

In Category (2) are the Resource and Sound functions.

As much effort went into this help file GBLIB1c.HLP as the DLL itself. This is because a DLL library is only useful if the functions are understood in their syntax and use.

Each Subroutine or Function has an explanation of it"s use, the original Pascal Prototype (so that it can be used with other languages) the Visual Basic Declaration, and, where appropriate, an example of how it can be used in VB, and/or an HPJ declaration.

Some of the sound functions have a live demo (CLICK ME) in this help file.

There were two important aims in writing the code:

All routines should be "system-resource-friendly", in that they should return any resources they consume. (eg DCs, Handles, Objects)

All routines should be as robust as possible, and capable of detecting their own errors.

Most routines check the parameters passed to them, and will return cleanly if they are bad, usually with a Message Box outlining the problem, and any resources returned.

Most functions return Zero for success, and 1 for failure. (except those which retrieve a value, of course)

GBLIB1c.DLL and associated help file are distributed as FREEWARE, under conditions outlined in the help file (See About)

The DLL was written in Borland Turbo Pascal for Windows(tm) V1.5 and this help file was written using Microsoft Word for Windows(tm) V6.0

Visual Basic and Binary Resources

One of the few failings of Visual Basic(tm) is it"s non-standard use of Windows resources.

VB resources are held in the FRX file, which is non-standard, and then bound into the EXE file at compilation in a non-standard way.

If your application uses many Bitmaps for example, you have two choices:

1) Compile them into the EXE file.

2) Use LoadPicture to load them in from disk.

Sounds always have to be loaded via external WAV files on disk.

Method (1) can result in an EXE file that will be unacceptably large to compile, and what"s more, the resources cannot be edited or changed without re-compilation.

Method (2) leaves your work subject to piracy or alteration. Many bitmaps and waves  can make distribution of your application lengthy and expensive on disks.

GBLIB1c.DLL tries to overcome these problems.

Using a resource editor, (ie. Resource Workshop(tm) from Borland) all Bitmap, Cursor,Icon, Wave and Text  items are bound into one or more DLL resource files.

These files are then used by your application (in association with the GBLIB1c.DLL functions) to retrieve the resources when needed.

An added bonus is that the resources remain secure, in that they can only be altered or removed by a knowlegable user of a Resource Editor.

Resources loaded from a DLL load MUCH faster than from disk, in most cases.

Another boon is the ability to load CURSORS and ICONS via resources - loading persistent cursors is very difficult in VB.

In addition, GBLIB1c.DLL contains functions which eliminate tedious API/DLL programming in VB. Functions like the SoundCard querying ones make life easier for the professional VB programmer who has to produce distributable VB applications.

Each function in GBLIB1c.DLL is documented where appropriate, with examples in the Function Reference  included in this helpfile.


Gordon Bamber

Gordon Bamber is currently a staff programmer with Maxim Training Consultants- a company specialising in Multimedia CBT and Financial Simulations.

Gordon can currently(05/95) be reached

Email:

FidoNet:

2:441/85.300

InterNet:

74437.672@compuserve.com

gordon.bamber@f85.n441.z2.fidonet.org

gbamber@cix.compulink.uk.com

Snailmail:

11, Helena road,

Brighton, E.Sussex, England.

BN2 6BS

Maxim Training can be reached at

74437.672@compuserve.com

57 Ship Street,

Brighton,

E.Sussex.

England.

+44 01273-204858


A Complete Asshole

Defined as:  An individual who uses or alters my software without acknowledging or crediting me in any way.


WAVE Files

MCI RIFF files having the extension WAV

You must have a sound output device attached to your PC in order to play these.

If such a sound device is absent, Windows 3.1(tm) will substitute a default speaker beep for the sound.


System Sounds

In Windows 3.1(tm) sounds can be specified as system sounds in Control Panel(tm).

These are stored in you WIN.INI file as:

[Sounds]

SystemStart=tada.wav

SystemEnd=terminat.wav

etc.

You can, of course, edit these entries manually via notepad, and even add your own

eg

MouseClick=click.wav

ProgramLaunch=sparkle.wav

etc.


[Sounds]

Entry=

Don"t worry if your WIN.INI does not contain this entry.

Use SYSEDIT (or your application code) to put it in. The Subroutine will then find it OK.

If it is absent, then a default System Beep will be played instead


ASCII 0

When you add a user resource and define it of type TEXT , Resource Workshop does not add an ASCII Zero (Binary Zero) to the end of the data.

You must edit the raw data yourself, and manually add &H00 as the last character in your text.

The function GetDLLText will retrieve all text up to (not including) this ASCII zero.  If you are getting unwanted extra characters, then the ASCII 0 is missing.


How to add a non-standard resource to a DLL

 (or ALT+x)

 WAV files and Text files using Resource Workshop (tm)Borland

1) Select File/Open Project, and open a DLL (It can be an empty one with no functions, but it must be a proper Windows DLL file)

2) Select File/Add to Project, and select Filetype as USER RESOURCE DATA.

3) Select a WAV file or an unformatted Text file from disk, and load it.

4) A dialog box titled Custom Resource Type will appear. Select the New Type button.

5) Type in WAVE or TEXT as the type (use Uppercase)

6) Rename the resource as necessary.

7) If TEXT, edit the raw data so that it ends with ASCII 0

Thats it! Save the project as a DLL, and the GBLIB1 functions can extract the WAVE and TEXT resources as needed.


LoadDLLBitmapFrom

 (or ALT+x)

Purpose

This function will display a whole or a part of a Bitmap from a DLL resource into a Form or PictureBox. It can be assigned to the Picture Property.

Left, Top, Right and Bottom defines the area of the Bitmap that you want to display. It is stretched to fit the Window

Returns

Zero=Success, NonZero=Failure

GBLIB1c.DLL Pascal Prototype

Function LoadDLLBitmapFrom (sz_Filename, sz_Resname: LPSTR; hWind, ThehDC: UINT; Left, Top, Right, Bottom :UINT) :INT

Visual Basic Declare

Declare Function LoadDLLBitmapFrom Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_BitMapResName As String, ByVal hWnd As Integer, ByVal ThehDC As Integer, ByVal i_Left As Integer, ByVal i_Top As Integer, ByVal i_Right As Integer, ByVal i_Bottom As Integer,) As Integer

Visual Basic Example

PictureBox.Autoredraw = True

i_Retval = LoadDLLBitmapFrom("c:\windows\MyBMPS.dll", "TOOLBITMAP", PictureBox.hWnd, PictureBox.hDC, 64,0,64,64)

Rem	//Test for failure//

If i_Retval Then

    MsgBox "Returned an error", 16, "LoadDLLBitmapFrom Function"

    Exit Sub

End If

Rem	//Make it permanent//

PictureBox.Picture = PictureBox.Image

End Sub

See...	LoadDLLBitmap	LoadDLLBitmapTo


LoadDLLDialog

 (or ALT+x)

Purpose

Loads a Dialog resource. The dialog must be a simple AboutBox type of dialog only.  Pass the form hWnd to the function.

GBLIB1c.DLL Pascal Prototype

Function LoadDLLDialog (sz_Filename, sz_Resname :LPSTR; hWind :UINT) :INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function LoadDLLDialog Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_DialogResName As String, ByVal hWnd As Integer) As Integer

Visual Basic Example

i_RetVal = LoadDLLDialog("RESFILE.DLL","ABOUTDLG","Me.hWnd)

Rem	//Test for failure//

If i_Retval Then

MsgBox "Returned an error", 16, "LoadDLLDialog Function"

Exit Sub

End If

See...	About


LoadDLLIcon

 (or ALT+x)

Purpose

Loads an Icon resource into the passed hWnd. The icon is placed at the Top and Left of the hwnd, and is not resized.

GBLIB1c.DLL Pascal Prototype

Function LoadDLLIcon (sz_Filename, sz_Resname :LPSTR; hWind, ThehDC :UINT) :INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function LoadDLLIcon Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_IconResName As String, ByVal hWnd As Integer, ByVal ThehDC As Integer) As Integer

Visual Basic Example

Me.Autoredraw = True

i_RetVal = LoadDLLIcon("RESFILE.DLL","PROGICON","Me.hWnd, Me.hDC)

Rem	//Test for failure//

If i_Retval Then

MsgBox "Returned an error", 16, "LoadDLLIcon Function"

Exit Sub

End If

Rem	//Make it permanent//

Me.Picture = Me.Image

See...	LoadDLLBitmap 	GetDLLText 	LoadDLLDialog 	LoadDLLCursor


LoadDLLCursor

 (or ALT+x)

Purpose

Loads a Cursor resource into the passed hWnd. The effect lasts until the mouse is moved outside the boundries of the class to which the hWnd belongs.

GBLIB1c.DLL Pascal Prototype

Function LoadDLLCursor (sz_Filename, sz_Resname :LPSTR;; hWind :UINT) :INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function LoadDLLCursor Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_CursorResName As String, ByVal hWnd As Integer) As Integer

Visual Basic Example

i_RetVal = LoadDLLCursor("RESFILE.DLL","HANDPTR","Me.hWnd)

Rem	//Test for failure//

If i_Retval Then

MsgBox "Returned an error", 16, "LoadDLLCursor Function"

Exit Sub

End If

See...	LoadDLLBitmap 	GetDLLText 	LoadDLLDialog 	LoadDLLIcon


DestroyDLLCursor

 (or ALT+x)

Purpose

Destroys a cursor set previously by LoadDLLCursor()

GBLIB1c.DLL Pascal Prototype

Procedure DestroyDLLCursor

Visual Basic Declare

Declare Sub DestroyDLLCursor Lib "GBLIB1c.DLL" ()

Visual Basic Example

DestroyDLLCursor

See...	LoadDLLCursor


SetArrow

 (or ALT+x)

Purpose

Sets the cursor for the passed hWnd to the default arrow.

GBLIB1c.DLL Pascal Prototype

Function SetArrow(hWind:UINT):INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function SetArrow "GBLIB1c.DLL" ( ByVal hWnd As Integer ) As Integer

Visual Basic Example

SetArrow

See...	LoadDLLCursor


GBSetCursorPos

 (or ALT+x)

Purpose

To set the cursor to a position relative to the Top and Left of the passed hWnd in pixels. The source hWnd need not have Scalemode=3

GBLIB1c.DLL Pascal Prototype

Function GBSetCursorPos(hWind:UINT;NewX,NewY:INT):INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function GBSetCursorPos Lib "GBLIB1c.DLL" (ByVal hWind As Integer, ByVal XPos As Integer, ByVal YPos As Integer) As Integer

Visual Basic Example

i_Retval = GBSetCursorPos Me.hWnd, 10, 10

If i_Retval Then

    MsgBox "Bad return from GBSetCursorPos ", 16, "ERROR"

    Exit Sub

End If


GBClientToScreenRECT

 (or ALT+x)

Purpose

Converts client co-ordinates into screen co-ordinates.

N.B. - Use VB"s built-in Screen.TwipsperpixelX and Screen.TwipsperpixelY for forms with ScaleMode=0.

GBLIB1c.DLL Pascal Prototype

Procedure GBClientToScreenRECT(hWind:UINT;Var MyRect:TRECT)

Visual Basic Declare

Type TRECT

     Left As Integer

     Top As Integer

     Right As Integer

     Bottom As Integer

End Type

Declare Sub GBClientToScreenRECT Lib "GBLIB1c.DLL" (ByVal hWind As Integer, ScreenRECT As TRECT)

Visual Basic Example

Dim MyRect as TRECT

Myrect.Left = Me.Left

MyRect.Top = Me.Top

MyRect.Right = Me.Width

MyRect.Bottom = Me.Height

GBClientToScreenRECT Me.hWnd, MyRect

InvertRect Me.hWnd, MyRect


GBDecompress

 (or ALT+x)

Purpose

Acts like the Microsoft(tm) DOS program EXPAND.EXE(c).  Enables a VB program to uncompress files on demand with just one call.

A program could store, say, version-specific data files, and decompress the appropriate ones as needed after installation.

Note that sz_OutFilePath is a directory path. If you specify the destination filename, it will be ignored, and the expanded filename will be substituted.

Sadly, there is no ability to compress files without COMPRESS.EXE(c) (A DOS program)

GBLIB1c.DLL Pascal Prototype

Function GBDecompress(sz_InFilePath,sz_OutFilePath:LPSTR):INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function GBDecompress Lib "GBLIB1c.DLL" (ByVal InfilePath As String, ByVal OutfilePath As String) As Integer

Visual Basic Example

i_Retval = GBDecompress (c:\install\readme.tx_, c:\app\readme.txt)

or i_Retval = GBDecompress (c:\install\readme.tx_, c:\app)

If i_Retval Then

    MsgBox "Bad return from GBDecompress", 16, "ERROR"

    Exit Sub

End If


GBPutOnTop

 (or ALT+x)

Purpose

Pass a form"s hWnd to this function, and it will stay on top of other windows, even when it does not have the focus.

GBLIB1c.DLL Pascal Prototype

Procedure GBPutOnTop(hWind:UINT)

Visual Basic Declare

Declare Sub GBPutOnTop Lib "GBLIB1c.DLL" (ByVal hWind As Integer)

Visual Basic Example

GBPutOnTop Me.hWnd


GBNotOnTop

 (or ALT+x)

Purpose

This will undo a GBPutOnTop  call.

GBLIB1c.DLL Pascal Prototype

Procedure GBNotOnTop(hWind:UINT)

Visual Basic Declare

Declare Sub GBNotOnTop Lib "GBLIB1c.DLL" (ByVal hWind As Integer)

Visual Basic Example

GBNotOnTop Me.hWnd


ModalCalc

 (or ALT+x)

Purpose

Puts up the Windows Calculator on top of all other windows until it is closed by the user.

If Calculator is already running, it will restore the running version to the top.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Function ModalCalc:INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function ModalCalc Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

i_RetVal = ModalCalc

If i_Retval Then

    MsgBox "Bad return from ModalCalc", 16, "ERROR"

    Exit Sub

End If

See...	ModalNotePad 	ModalNotePadExec


ModalNotePad

 (or ALT+x)

Purpose

Runs Windows Notepad on top of all other windows, and keeps on top until the user shuts it down.

NB	If Notepad is already running, it is brought to the top.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Function ModalNotePad:INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function ModalNotePad Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

i_Retval = ModalNotePad()

If i_Retval Then

    MsgBox "Bad return from ModalNotePad", 16, "ERROR"

    Exit Sub

End If

See...	ModalCalc 	ModalNotePadExec


ModalNotePadExec

 (or ALT+x)

Purpose

Runs Windows Notepad with a specified file on top of all other windows, and keeps on top until the user shuts it down.

NB	If Notepad is already running, it is brought to the top.

ModalNotePadExec could be used to show README files upon successful installation of your application.

GBLIB1c.DLL Pascal Prototype

Function ModalNotePadExec(sz_Txtname:LPSTR):INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function ModalNotePadExec Lib "GBLIB1c.DLL" (ByVal szFilePath As String) As Integer

Visual Basic Example

i_RetVal = ModalNotePadExec ( "c:\appdir\readme.txt" )

If i_Retval Then

    MsgBox "Bad return from ModalNotePadExec", 16, "ERROR"

    Exit Sub

End If

See...	ModalCalc 	ModalNotePad


MakeUAE

 (or ALT+x)

Purpose

This is a pointless and tasteless joke routine.  It simulates a General Protection Fault, but unlike a real one, returns without harm.  Someone with a purile sense of humour must have written this one.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure MakeUAE

Visual Basic Declare

Declare Sub MakeUAE Lib "GBLIB1c.DLL" ()

Visual Basic Example

MakeUAE

MsgBox "Hah! I was only fooling!"


WaitForL

 (or ALT+x)

Purpose

This is a modal timer, in other words, a PAUSE statement.  Code will stop executing, and all user actions are defrerred until the WaitForL returns.

The L stands for Long - the data type that must be passed to this subroutine.  The time is in MilliSeconds. As the system clock ticks as 18.2 ticks/second, the shortest time that can be passed is about 55ms. All user input is disabled.

GBLIB1c.DLL Pascal Prototype

Procedure WaitForL(l_Millisecs:LONGINT)

Visual Basic Declare

Declare Sub WAITFORL Lib "GBLIB1c.DLL" (ByVal MilliSeconds As Long)

Visual Basic Example

WaitForL 1000

rem	//Wait a second//

WaitForL 100

rem	//Wait 1/10th of a second//

See..	WaitFor


WaitFor

 (or ALT+x)

Purpose

WaitFor is a Visual Basic PAUSE statement. Pass it the number of seconds that you want to wait. No code or user input will get executed until it returns.

Possible use - A Splash Screen timer.

GBLIB1c.DLL Pascal Prototype

Procedure WaitFor(i_seconds:INT)

Visual Basic Declare

Declare Sub WaitFor Lib "GBLIB1c.DLL" (ByVal Seconds As Integer)

Visual Basic Example

WaitFor 1

rem	//Hold on a second!//

Splashfrm.Show

rem	//Make sure that the user cannot escape from seeing it//

WaitFor 5

Unload Splashfrm

See..	WaitForL


SpeakerBeep

 (or ALT+x)

Purpose

Sounds the system built-in speaker.  If the user has a soundcard, it will be ignored, and the speaker will be used.

The user may have the default mci beep turned off, but a SpeakerBeep will still make a sound.

CLICK ME for an example.

GBLIB1c.DLL Pascal Prototype

Procedure SpeakerBeep

Visual Basic Declare

Declare Sub SpeakerBeep Lib "GBLIB1c.DLL" ()

Visual Basic Example

SpeakerBeep

Msgbox "An error has occurred",16,"That woke you up!"

See..	PlaySound 	WillPlay 	Click 	Clik


StartWait

 (or ALT+x)

Purpose

Together with the WAITONE and STOPWAIT procedures, StartWait implements a CLOCK Cursor that will animate 12-o-clock thru 12-o-clock with each call to WaitOne.

Used instead of the hourglass cursor to show the passing of time during a lengthy process.

GBLIB1c.DLL Pascal Prototype

Procedure StartWait(hWind:UINT)

Visual Basic Declare

Declare Sub StartWait Lib "GBLIB1c.DLL" (ByVal hWind As Integer)

Visual Basic Example

StartWait Me.hWnd

rem	//Initialise clockcursor//

Call DoCalc

StopWait Me.hWnd

rem	//Return to normal cursor, and free-up resources//

Sub DoCalc

For x = 1 to aLot

rem	//Twizzle the clock another hour//

WaitOne Me.hWnd

DoAnotherCalc

Next X

Exit Sub

See..	WaitOne 	StopWait


StopWait

 (or ALT+x)

Purpose

Called to return the cursor to normal, and clean up resources after using StartWait/WaitOne.

GBLIB1c.DLL Pascal Prototype

Procedure StopWait (hWind : hCursor); Export

Visual Basic Declare

Declare Sub StopWait Lib "GBLIB1c.DLL" ( ByVal MyhWnd As Integer)

Visual Basic Example

StartWait Me.hWnd

rem	//Initialise clockcursor//

Call DoCalc

StopWait Me.hWnd

rem	//Return to normal cursor, and free-up resources//

Sub DoCalc

For x = 1 to aLot

rem	//Twizzle the clock another hour//

WaitOne Me.hWnd

DoAnotherCalc

Next X

Exit Sub

See..	StartWait 	WaitOne


WaitOne

 (or ALT+x)

Purpose

Advances the clock cursor set up in STARTWAIT one hour.

GBLIB1c.DLL Pascal Prototype

Procedure WaitOne (MyhWnd : hCursor); Export

Visual Basic Declare

Declare Sub WaitOne Lib "GBLIB1c.DLL" ( ByVal MyhWnd As Integer)

Visual Basic Example

StartWait Me.hWnd

rem	//Initialise clockcursor//

Call DoCalc

StopWait Me.hWnd

rem	//Return to normal cursor, and free-up resources//

Sub DoCalc

For x = 1 to aLot

rem	//Twizzle the clock another hour//

WaitOne Me.hWnd

DoAnotherCalc

Next X

Exit Sub

See..	StartWait 	StopWait


LoadEXEIcon

 (or ALT+x)

Purpose

Borrows the first Icon it can find in the specified EXE file, and displays it at position 0,0 in the passed hWnd.

GBLIB1c.DLL Pascal Prototype

Function LoadEXEIcon(hWind, MyhDC : UINT;sz_EXEPath:LPSTR):INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function LoadEXEIcon Lib "GBLIB1c.DLL" (ByVal hWind As Integer, ByVal MyhDC As Integer, ByVal szFilename As String) As Integer

Visual Basic Example

Picture1.Autoredraw = True

i_RetVal = LoadEXEIcon ( Picture1.hWnd, Picture1.hDC, "c:\windows\progman.exe" )

If i_Retval Then

    MsgBox "Bad return from LoadEXEIcon", 16, "ERROR"

    Exit Sub

End If

Rem	//Make it permanent//

Picture1.Picture = Picture1.Image

See..	LoadEXEIconXY


SubClassIt

 (or ALT+x)

Purpose

Unfortunately, Visual Basic(tm) does not have a Message Handling loop, as other languages (Pascal, C, C++) have.  This means that there are (a very few) messages that cannot be picked up by the VB programmer.

Using SubClassIt, you can detect Non-Client (eg MenuBar) mouseclick events, the Form_Move event, and Memory-Compacting and WM_POWER events.

While the window is subclassed, the right_mousebutton_down event is mapped to the left_mousebutton_down event - that may be useful in itself.

The extra message events are all diverted to the Visual Basic Sub form_mousedown event.  The type of message is indicated by the X parameter. (Normally this is the X-Position of the mouse, of course)

In addition, a right mousebutton double-click will trigger the default Windows Screen-Saver.

GBLIB1c.DLL Pascal Prototype

Procedure SubClassIt(hWind:UINT)

Visual Basic Declare

Declare Sub SubClassIt Lib "GBLIB1c.DLL" (ByVal hWind As Integer)

rem	//Use the current form hWnd//

Visual Basic Example

rem	//Use the current form hWnd//

SubClassIt Me.hWnd

Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim msg As String

If Button = 1 Then

MsgBox "Left_MouseButton Clicked", 64, "Form_MouseDown"

Exit Sub

Else

rem	//If subClassing then X= following values: //

rem	//0=NC_Left, 1=NC_Right, 2=Form_Move, 3=Compacting, 4=POWER//

Select Case X

Case 0

msg = "Non-Client Left Button clicked."

Case 1

msg = "Non-Client Right Button clicked."

Case 3

msg = "Windows is Compacting Memory."

MsgBox msg, 64, "Subclassing via GBLIB1c.DLL"

UnSubClassIt

Case Else

msg = "Right_MouseButton Clicked"

End Select

MsgBox msg, 64, "Subclassing via GBLIB1c.DLL"

End If

End Sub

See...	UnSubClassIt


UnSubClassIt

 (or ALT+x)

Purpose

This routine restores things to nomal after a call to SubClassIt . The Form_MouseDown event will revert to Visual Basic(tm) behaviour.

GBLIB1c.DLL Pascal Prototype

Procedure UnSubClassIt

Visual Basic Declare

Declare Sub UnSubClassIt Lib "GBLIB1c.DLL" ()

Visual Basic Example

UnSubCalssIt

See...	SubClassIt


LoadEXEIconXY

 (or ALT+x)

Purpose

This routine will load the first Icon it finds (usually the application Icon) from the specified EXE file, and display it in the specified hWnd at the co-ordinates X, Y.

GBLIB1c.DLL Pascal Prototype

Function LoadEXEIconXY(hWind, MyhDC : UINT; sz_EXEPath : LPSTR; X, Y : INT) :INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function LoadEXEIconXY Lib "GBLIB1c.DLL" (ByVal hWind As Integer, ByVal MyhDC As Integer. ByVal sz_EXEname As String, ByVal Xpos as Integer, ByVal Ypos as Integer) As Integer

Visual Basic Example

picLoadIcon.Autoredraw = True

i_Retval = LoadEXEIconXY(picLoadIcon1.hWnd, picLoadIcon.hDC, "C:\WINDOWS\PROGMAN.EXE", 10,10)

If i_Retval Then

    MsgBox "Bad return from LoadEXEIconXY", 16, "ERROR"

    Exit Sub

End If

Rem	//Make it permanent//

PicLoadIcon.Picture = PicLoadIcon.Image

See...	LoadEXEIcon 	LoadDLLIcon


LoadDLLIconXY

 (or ALT+x)

Purpose

This routine will load an Icon from the resources of the specified DLL into the specified PictureBox or Form at the co-ordinates X, Y.

GBLIB1c.DLL Pascal Prototype

Function LoadDLLIconXY(sz_Filename, sz_Resname :LPSTR;hWind, MyhDC :UINT; X,Y :INT) :INT

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function LoadDLLIconXY Lib "GBLIB1c.DLL" (ByVal sz_DLLFile As String, ByVal sz_ICO_Resname As String, ByVal hWind As Integer, ByVal MyhDC As Integer, ByVal i_Left As Integer, ByVal i_Top As Integer) As Integer

Visual Basic Example

PictureBox1.Autoredraw = True

i_RetVal = LoadDLLIconXY("VBRES.DLL","PROGICON","PictureBox1.hWnd, PictureBox1.hDC, 10,10)

If i_Retval Then

    MsgBox "Bad return from LoadDLLIconXY", 16, "ERROR"

    Exit Sub

End If

Rem	//Make it permanent//

PictureBox1.Picture = PictureBox1.Image

See...	LoadDLLIcon


SetUpJoystick

 (or ALT+x)

Purpose

Visual Basic provides no built-in Joystick support.  Using the MMSYSTEM.DLL mci services, this function sets up a Joystick interface.

If there is no joystick connected, or some other error, a message is displayed to that effect.

UnSetUpJoystick de-initialises the services, and returns all resources.

Joystick co-ordinates are passed to the MouseMove event.

GBLIB1c.DLL Pascal Prototype

procedure SetUpJoyStick(hWind:UINT)

Visual Basic Declare

Declare Sub SetUpJoyStick Lib "GBLIB1c.DLL" (ByVal hWind As Integer)

Visual Basic Example

SetUpJoyStick Me.hWnd

See...	UnSetupJoystick


UnSetUpJoyStick

 (or ALT+x)

Purpose

After a call to SetUpJoystick , this routine de-initialises the Joystick handlers and returns all resources.

GBLIB1c.DLL Pascal Prototype

Procedure UnSetUpJoyStick

Visual Basic Declare

Declare Sub UnSetUpJoystick Lib "GBLIB1c.DLL" ()

Visual Basic Example

UnSetUpJoyStick

See...	SetupJoystick


WillPlay

WillPlay...

 (or ALT+x)

Purpose

A series of functions that return a TRUE/FALSE value.  You can use one or more to test a Users hardware before playing WAVE files on their system.

You could have 2 or more versions of the same sound, and, depending on the users hardware, play the best quality that they can support.

Eliminates a lot of tedious VB programming.

GBLIB1c.DLL Pascal Prototypes

Function WillPlay811Mono:INT

Function WillPlay1611Mono:INT

Function WillPlay811Stereo:INT

Function WillPlay1611Stereo:INT

Function WillPlay822Mono:INT

Function WillPlay1622Mono:INT

Function WillPlay822Stereo:INT

Function WillPlay1622Stereo:INT

Function WillPlay844Mono:INT

Function WillPlay1644Mono:INT

Function WillPlay844Stereo:INT

Function WillPlay1644Stereo:INT

Returns

Zero=False, NonZero=True

N.B.	The SoundBlaster AWE32 returns True for them all.

Visual Basic Declares

Declare Function WillPlay811Mono Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay811Stereo Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay1611Mono Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay1611Stereo Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay822Mono Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay822Stereo Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay1622Mono Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay1622Stereo Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay844Mono Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay844Stereo Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay1644Mono Lib "GBLIB1c.DLL" () As Integer

Declare Function WillPlay1644Stereo Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Sub PlayThisSound

If WillPlay1644Stereo() > 0 then

i_RetVal=PlayResource("mysounds.dll","HIFISOUND")

If i_RetVal then Exit Sub

Else

i_RetVal=PlayResource("mysounds.dll","LOWFISOUND")

If i_RetVal then Exit Sub

EndIf

End Sub


GetWaveVendorID

 (or ALT+x)

Purpose

Use to determine the type of soundcard in a machine.  Each manufacturer has a unique ID.

GBLIB1c.DLL Pascal Prototype

Function GetWaveVendorID:INT

Returns

The Vendor ID

N.B. The SoundBlaster AWE32(tm) returns the number 2

Visual Basic Declare

Declare Function GetWaveVendorID Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

i_VendorID = GetWaveVendorID()

Select Case i_VendorID

Case....


GetWaveProductID

 (or ALT+x)

Purpose

Used to query the soundcard setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetWaveProductID:INT

Returns

The Product ID

N.B. The SoundBlaster AWE32(tm) returns the number 104

Visual Basic Declare

Declare Function GetWaveProductID Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

i_ProductID = GetWaveProductID()

Select Case i_ProductID

Case....


GetWaveDriverVersion

 (or ALT+x)

Purpose

Used to query the soundcard setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetWaveDriverVersion(var Major,Minor:INT):INT

Returns

Zero=Success, NonZero=Failure

N.B. The SoundBlaster AWE32(tm) driver returns the number 1.17

Visual Basic Declare

Declare Function GetWaveDriverVersion Lib "GBLIB1c.DLL" (Major As Integer, Minor As Integer) As Integer

Visual Basic Example

i_RetVal = GetWaveDriverVersion(Major, Minor)

If i_RetVal Then

    MsgBox "Error in GetWaveDriverVersion", 48, "GBLIB1c.DLL"

    Exit Sub

End If

MsgBox "Driver version is " & Format$(Major) & "." & Format$(Minor)


GetWaveProductName

 (or ALT+x)

Purpose

Used to query the soundcard setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetWaveProductName(sz_Buffer:LPSTR;var i_Len:UINT):INT

Returns

Zero=Success, NonZero=Failure

N.B. The SoundBlaster AWE32(tm) returns the string "SB16 WAVE OUT"

Visual Basic Declare

Declare Function GetWaveProductName Lib "GBLIB1c.DLL" (ByVal szBuffer As String, i_BufferLen As Integer) As Integer

Visual Basic Example

Dim szBuf as String * 255

ALen = GetWaveProductName(szBuf, 255)

msg = Left$(szBuf, ALen)

MsgBox msg, 64, "Sound Card Driver Name"


GetWaveNumChannels

 (or ALT+x)

Purpose

Used to query the soundcard setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetWaveNumChannels:INT

Returns

1 = Mono, 2 = Stereo

N.B. The SoundBlaster AWE32(tm) returns the number 2

Visual Basic Declare

Declare Function GetWaveNumChannels Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

msg = "No. of Channels: " & Format$(GetWaveNumChannels())

MsgBox msg, 64, "GBLIB1c.DLL Report"


GetMIDIVendorID

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDIVendorID:INT

Returns

The MIDI Vendor ID number.

N.B. The SoundBlaster AWE32(tm) returns the number 30

Visual Basic Declare

Declare Function GetMIDIVendorID Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim msg As String

Dim nl As String

nl = Chr$(10)

msg = "MIDI Capabilities" & nl

msg = msg & "Vendor  ID: " & Format$(GetMIDIVendorID()) & nl

msg = msg & "Product ID: " & Format$(GetMIDIProductID()) & nl

msg = msg & "No. of Voices: " & Format$(GetMIDIVoices()) & nl

msg = msg & "No. of Notes: " & Format$(GetMIDINotes()) & nl

msg = msg & "No. of Channels: " & Format$(GetMIDINumChannels())

MsgBox msg, 64, "GBLIB1c.DLL Report"


GetMIDIProductID

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDIProductID:INT

Returns

The Product ID

N.B. The SoundBlaster AWE32(tm) returns the number 15

Visual Basic Declare

Declare Function GetMIDIProductID Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim msg As String

Dim nl As String

nl = Chr$(10)

msg = "MIDI Capabilities" & nl

msg = msg & "Vendor  ID: " & Format$(GetMIDIVendorID()) & nl

msg = msg & "Product ID: " & Format$(GetMIDIProductID()) & nl

msg = msg & "No. of Voices: " & Format$(GetMIDIVoices()) & nl

msg = msg & "No. of Notes: " & Format$(GetMIDINotes()) & nl

msg = msg & "No. of Channels: " & Format$(GetMIDINumChannels())

MsgBox msg, 64, "GBLIB1c.DLL Report"


GetMIDIDriverVersion

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDIDriverVersion(var Major,Minor:INT):INT

Returns

The Version number of the MIDI driver.

N.B. The SoundBlaster AWE32(tm) driver returns 1.51

Visual Basic Declare

Declare Function GetMIDIDriverVersion Lib "GBLIB1c.DLL" (Major As Integer, Minor As Integer) As Integer

Visual Basic Example

Dim msg As String

Dim ALen As Integer

Dim Major As Integer

Dim Minor As Integer

Dim i_RetVal As Integer

Dim szBuf As String * 255

i_RetVal = GetMIDIDriverVersion(Major, Minor)

If i_RetVal Then

    MsgBox "Error in GetMIDIDriverVersion", 48, "GBLIB1c.DLL"

    Exit Sub

End If

MsgBox "Driver version is " & Format$(Major) & "." & Format$(Minor), 64, "GetMIDIDriverVersion"


GetMIDIProductName

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDIProductName(sz_Buffer:LPSTR;var i_Len:UINT):INT

Returns

The Product name of the MIDI driver.

N.B. The SoundBlaster AWE32(tm) returns the string "Voyerta Super Sapi FM Driver"

Visual Basic Declare

Declare Function GetMIDIProductName Lib "GBLIB1c.DLL" (ByVal szBuffer As String, i_BufferLen As Integer) As Integer

Visual Basic Example

Dim msg As String

Dim ALen As Integer

Dim szBuf As String * 255

ALen = GetMIDIProductName(szBuf, 255)

msg = "Driver: " & Left$(szBuf, ALen)

MsgBox msg, 64, "GBLIB1 - GetMIDIProductName"


GetMIDIVoices

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDIVoices:INT

Returns

Number of simultaneous MIDI Voices supported.

N.B. The SoundBlaster AWE32(tm) returns the number 14

Visual Basic Declare

Declare Function GetMIDIVoices Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim msg As String

Dim nl As String

nl = Chr$(10)

msg = "MIDI Capabilities" & nl

msg = msg & "Vendor  ID: " & Format$(GetMIDIVendorID()) & nl

msg = msg & "Product ID: " & Format$(GetMIDIProductID()) & nl

msg = msg & "No. of Voices: " & Format$(GetMIDIVoices()) & nl

msg = msg & "No. of Notes: " & Format$(GetMIDINotes()) & nl

msg = msg & "No. of Channels: " & Format$(GetMIDINumChannels())

MsgBox msg, 64, "GBLIB1c.DLL Report"


GetMIDINotes

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDINotes:INT

Returns

Number of simultaneous MIDI notes supported.

N.B. The SoundBlaster AWE32(tm) returns the number 14

Visual Basic Declare

Declare Function GetMIDINotes Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim msg As String

Dim nl As String

nl = Chr$(10)

msg = "MIDI Capabilities" & nl

msg = msg & "Vendor  ID: " & Format$(GetMIDIVendorID()) & nl

msg = msg & "Product ID: " & Format$(GetMIDIProductID()) & nl

msg = msg & "No. of Voices: " & Format$(GetMIDIVoices()) & nl

msg = msg & "No. of Notes: " & Format$(GetMIDINotes()) & nl

msg = msg & "No. of Channels: " & Format$(GetMIDINumChannels())

MsgBox msg, 64, "GBLIB1c.DLL Report"


GetMIDINumChannels

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototype

Function GetMIDINumChannels:INT

Returns

Number of MIDI Channels supported

N.B. The SoundBlaster AWE32(tm) returns the number 8

Visual Basic Declare

Declare Function GetMIDINumChannels Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim msg As String

Dim nl As String

nl = Chr$(10)

msg = "MIDI Capabilities" & nl

msg = msg & "Vendor  ID: " & Format$(GetMIDIVendorID()) & nl

msg = msg & "Product ID: " & Format$(GetMIDIProductID()) & nl

msg = msg & "No. of Voices: " & Format$(GetMIDIVoices()) & nl

msg = msg & "No. of Notes: " & Format$(GetMIDINotes()) & nl

msg = msg & "No. of Channels: " & Format$(GetMIDINumChannels())

MsgBox msg, 64, "GBLIB1c.DLL Report"


IsMIDI

IsMIDI...

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototypes

Function IsMIDIExternalSynth:INT

Function IsMIDISquareWaveSynth:INT

Function IsMIDIFMSynth:INT

Function IsMIDIGenericSynth:INT

Function IsMIDIMapper:INT

Returns

No=0, Yes=1

Visual Basic Declares

Declare Function IsMIDIExternalSynth Lib "GBLIB1c.DLL" () As Integer

Declare Function IsMIDISquareWaveSynth Lib "GBLIB1c.DLL" () As Integer

Declare Function IsMIDIFMSynth Lib "GBLIB1c.DLL" () As Integer

Declare Function IsMIDIMapper Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim msg as String

If IsMIDIExternalSynth() then msg = " an external synthesiser"

If IsMIDISquareWaveSynth() then msg = "a square wave synthesiser"

If IsMIDIFMSynth() then msg = "an FM synthesiser"

If IsMIDIMapper() then msg = "diverted through MIDI Mapper"

msg = "Your MIDI is " & msg

MsgBox msg, 64, "IsMIDI Functions"


WillMidiDoVolume

WillMidiDo...

 (or ALT+x)

Purpose

Used to query the MIDI setup installed in a target machine.

GBLIB1c.DLL Pascal Prototypes

Function WillMidiDoVolume:INT

Function WillMidiDoLRVolume:INT

Function WillMidiDoCache:INT

Returns

No=0, Yes=1

Visual Basic Declares

Declare Function WillMidiDoVolume Lib "GBLIB1c.DLL" () As Integer

Declare Function WillMidiDoLRVolume Lib "GBLIB1c.DLL" () As Integer

Declare Function WillMidiDoCache Lib "GBLIB1c.DLL" () As Integer

Visual Basic Example

Dim Msg as String

Dim nl as String

nl = Chr$(13)

Msg = "Your MIDI setup." & nl

If WillMidiDoVolume() then Msg = Msg & "It can Vary the Volume" & nl

If WillMidiDoLRVolume() then Msg = Msg & "and also do this in Stereo!" & nl

If WillMidiDoCache() then Msg = Msg & "It can Cache Patches." & nl

MsgBox Msg, 64 "GBLIB1c.DLL MIDI Report"


{bml optblu.bmp}GBLIB1.DLL Function Reference by Category

GBLIB1c.DLL Function Reference by Category

 (or ALT+x)

Retrieving Resources from a DLL

Sound Functions

VB Add-Ons

See...	Complete Function Reference


Retrieving Resources from a DLL

 (or ALT+x)

Click the sub or function name to obtain more information

Function PlayResource 	index 7

Function PlayDLLWave 	index 2

PlayDLLWaveExt 	Index 85

Function GetDLLBitmapSize 	index 5

Function LoadDLLBitmap 	index 3

LoadDLLBitmapFrom 	index 25

Function LoadDLLBitmapTo 	index 6

Function GetDLLText 	index 4

LoadDLLDialog 	index 26

LoadDLLIcon 	index 27

LoadDLLIconXY 	index 50

LoadEXEIcon 	index 46

LoadEXEIconXY 	index 49

LoadDLLCursor 	index 28

DestroyDLLCursor 	index 29

See...	Complete Function Reference


Sound Functions

 (or ALT+x)

Click the sub or function name to obtain more information

Function PlayResource 	index 7

Function PlayDLLWave 	index 2

PlayDLLWaveExt 	Index 85

Sub PlayLoop 	index 10

Sub StopLoop 	index 11

Sub SystemStart 	index 15

Sub SystemEnd 	index 16

Sub SystemBeep 	index 17

Sub SystemQuestion 	index 18

Sub SystemExclamation 	Index 19

Sub SystemAsterisk 	index 20

Sub SystemHand 	index 21

Sub MouseClick 	index 22

Sub ProgramLaunch 	index 23

Sub PlaySound 	index 24

SpeakerBeep 	index 42

WillPlay811Mono 	index 53

WillPlay811Stereo 	index 54

WillPlay1611Mono 	index 55

WillPlay1611Stereo 	index 56

WillPlay822Mono 	index 57

WillPlay822Stereo 	index 58

WillPlay1622Mono 	index 59

WillPlay1622Stereo 	index 60

WillPlay844Mono 	index 61

WillPlay844Stereo 	index 62

WillPlay1644Mono 	index 63

WillPlay1644Stereo 	index 64

GetWaveVendorID 	index 65

GetWaveProductID 	Index 66

GetWaveDriverVersion 	Index 67

GetWaveProductName 	Index 68

GetWaveNumChannels 	Index 69

GetMIDIVendorID 	index 70

GetMIDIProductID 	Index 71

GetMIDIDriverVersion 	Index 72

GetMIDIProductName 	Index 73

GetMIDIVoices 	Index 74

GetMIDINotes 	Index 75

GetMIDINumChannels 	Index 76

IsMIDI 	Index 77

IsMIDISquareWaveSynth 	Index 78

IsMIDIFMSynth 	Index 79

IsMIDIGenericSynth 	Index 80

IsMIDIMapper 	Index 81

WillMidiDoVolume 	Index 82

WillMidiDoLRVolume 	Index 83

WillMidiDoCache 	Index 84

See...	Complete Function Reference


VB Add-Ons

 (or ALT+x)

Click the sub or function name to obtain more information

Sub About 	index 1

SetArrow 	index 30

GBSetCursorPos 	index 31

GBClientToScreenRECT 	index 32

GBDecompress 	index 33

GBPutOnTop 	index 34

GBNotOnTop 	index 35

ModalCalc 	index 36

ModalNotePad 	index 37

ModalNotePadExec 	index 38

MakeUAE 	index 39

WaitForL 	index 40

WaitFor 	index 41

StartWait 	index 43

StopWait 	index 44

WaitOne 	index 45

LoadEXEIcon 	index 46

SubClassIt 	index 47

UnSubClassIt 	index 48

LoadEXEIconXY 	index 49

SetUpJoystick 	index 51

UnSetUpJoyStick 	index 52

GBGetDiskSizeS 	Index 86

GBGetDiskSizeL 	Index 87

GBGetDiskFreeS 	Index 88

GBGetDiskFreeL 	Index 89

GBIsFileInPath 	Index 90

EncodeSingle 	Index 91

DecodeSingle 	Index 92

InstallAFont 	Index 93

GetNumColours 	Index 95

DisableMouse 	Index 96

EnableMouse 	Index 97

GetJoyPos 	Index 98

RegisterAppExt 	Index 99

RegisterAppPrintExt 	Index 100

UnRegisterAppExt  	Index 101

UnRegisterAppPrintExt 	Index 102

UnRegisterAll 	Index 103

See...	Complete Function Reference


System requirements for using/distributing GBLIB1.DLL

System requirements for using/distributing GBLIB1c.DLL

 (or ALT+x)

You may distribute GBLIB1c.DLL freely. (See About )

In order to run applications using services provided by GBLIB1c.DLL you will need to ensure that the following libraries are installed on both your and the target machine:

Library	Purpose

GBLIB1c.DLL	Functions in this Help File

(Supplied with Windows(tm) V3.1 and V3.11 as standard)

MMSYSTEM.DLL	Sound and Joystick services

LZEXPAND.DLL	GBDecompress function

SHELL.DLL	Icon services and Registration services

(Optional)

IBMJOY.DRV	JoyStick functionality

The target machine should be running Windows 3.1 or V3.11 in Enhanced mode.

You can install the DLLs in the users Windows/System directory (Obtained by a call to the API function GetSystemDirectory) or you can install them all in the same directory as your application.

I would recommend the second option, as it eliminates any version conflicts with existing DLLs on the users system.

I know that Microsoft(tm) recommend that DLLs be installed in the System directory, but they, and a lot of other software distributors break this rule for the practical reason that Version checking just does not work in practice to the benefit of the user

See...	About GBLIB1c.DLL and Conditions of Use


InstallAFont

 (or ALT+x)

Purpose

InstallAFont allows you to bundle a True Type(tm) font with your Visual Basic Application, and Install it on the Users system transparently.

If the User already has the font, then InstallAFont will do nothing.

This function will install the StyleName in the WIN.INI [fonts] section.
If the TTF File is called WIERD.TTF and the Stylename is "MyFont", and the user"s SYSTEM directory is C:\WINDOWS\SYSTEM, then the section will read:

[fonts]

...other fonts already installed...

MyFont (TrueType)=C:\WINDOWS\SYSTEM\WIERD.FOT

On susequent calls to InstallaFont, this entry will be checked for, and the function will return early if it is present. Thus it is quite practical to include an InstallaFont call into a Form_Load event., with form properties set to use the font subsequently.

IMPORTANT - You should only distribute and install fonts for which you have legal copyright permission by the font copyright holder.  InstallaFont does not check the read-only status of a True-Type font, and it is up to you to be honest about its use.

GBLIB1c.DLL Pascal Prototype

Function InstallAFont (sz_TTFPath, sz_StyleName :LPSTR) :INT ;Export;

Returns

Zero=Success, NonZero=Failure

Visual Basic Declare

Declare Function InstallAFont Lib "GBLIB1c.DLL" (ByVal sz_TTFPath as String, ByVal sz_StyleName As String) As Integer

Visual Basic Example

Dim i_RetVal as Integer

i_RetVal = InstallaFont ("C:\APPDIR\ARIALBI.TTF", "Arial Bold Italic")

If i_RetVal = 0 Then

AnyControl.Fontname = "Arial Bold Italic"

Else

AnyControl.Fontname = "MSSerif"

End If


PlayDLLWaveExt

 (or ALT+x)

Purpose

This is the same as PlayDLLWave , except the uFlags parameter allows you to specify how the sound will be played.

GBLIB1c.DLL Pascal Prototype

Function PlayDLLWaveExt ( szFilename, lpname: LPSTR; uFlags: UINT) :INT ;Export;

Visual Basic Declare

Declare Function PlayDLLWaveExt Lib "GBLIB1c.DLL" (ByVal sz_DLLFilename as String, ByVal sz_ResourceName as String, ByVal uFlags as Integer) as Integer

'	//Constants for the uFlags parameter in PlayDLLWaveExt (Do not use snd_Memory)//

'	//You can combine more than one with AND i.e. snd_NoDefault+snd_Loop = 10 //

Global Const snd_Sync = 0'  { play synchronously (default) }

Global Const snd_Async = 1'  { play asynchronously }

Global Const snd_NoDefault = 2'  { don't use default sound }

Global Const snd_Loop = 8'  { loop the sound until next sndPlaySound }

Global Const snd_NoStop = 16'  { don't stop any currently playing sound }

Visual Basic Example

Dim i_RetVal as Integer

i_RetVal = PlayDLLWaveExt ("sounds.dll", "RUDESOUND", SND_SYNC)

See...	PlayDLLWave


GBGetDiskSizeS

 (or ALT+x)

Purpose

A very straightforward Subroutine that returns the size of the default (Usually C:) disk drive in a formatted string.

GBLIB1c.DLL Pascal Prototype

Procedure GBGetDiskSizeS(sz_Buff : LPSTR ; Var i_BuffLen : INT);Export;

Visual Basic Declare

Declare Sub GBGetDiskSizeS Lib "GBLIB1c.DLL" ( sz_Buff as String, i_BuffLen as Integer)

Visual Basic Example

Dim sz_Buffer as string

Dim i_BuffLen as Integer

sz_Buffer = Space$(127)

GBGetDiskSizeS (sz_Buffer, i_BuffLen)

sz_Buffer = Left$(sz_Buffer, i_BuffLen)

Print "Default drive is" & sz_Buffer & "Bytes big."

See...	GBGetDiskSizeL , GBGetDiskFreeS , GBGetDiskFreeL


GBGetDiskSizeL

 (or ALT+x)

Purpose

A function that will query any drive from A to Z. This function does not fail on an empty floppy drive, and will return zero bytes in such a case.

GBLIB1c.DLL Pascal Prototype

Function GBGetDiskSizeL (sz_DriveLetter : LONGINT) : LONGINT ;Export;

Visual Basic Declare

Declare Function GBGetDiskSizeL Lib "GBLIB1c.DLL" ( ByVal sz_DriveLetter as String) as Long

Visual Basic Example

If GBGetDiskSizeL( "A" ) > 0 Then

Print "Drive A is a " & Format$( GBGetDiskSizeL("A" )/1024, "###,###,##0") & " K drive. "

End If

Print "Drive D is a " & Format$( GBGetDiskSizeL("D" )/1024, "###,###,##0") & " K drive. "

See...	GBGetDiskSizeS , GBGetDiskFreeS , GBGetDiskFreeL


GBGetDiskFreeS

 (or ALT+x)

Purpose

A very straightforward Subroutine that returns the number of bytes free on the default (Usually C:) disk drive in a formatted string.

GBLIB1c.DLL Pascal Prototype

Procedure GBGetDiskFreeS ( sz_Buff : LPSTR Var i_BuffLen : INT); Export;

Visual Basic Declare

Declare Sub GBGetDiskFreeS Lib "GBLIB1c.DLL" ( sz_Buff as String, i_BuffLen as Integer)

Visual Basic Example

Dim sz_Buffer as string

Dim i_BuffLen as Integer

sz_Buffer = Space$(127)

GBGetDiskFreeS (sz_Buffer, i_BuffLen)

sz_Buffer = Left$(sz_Buffer, i_BuffLen)

Print "Default drive has " & sz_Buffer & " Bytes free. "

See...	GBGetDiskSizeL , GBGetDiskSizeS , GBGetDiskFreeL


GBGetDiskFreeL

 (or ALT+x)

Purpose

A function that will query any drive from A to Z. This function does not fail on an empty floppy drive, and will return zero bytes in such a case.

GBLIB1c.DLL Pascal Prototype

Function GBGetDiskSizeL (sz_DriveLetter : LONGINT) : LONGINT ;Export;

Visual Basic Declare

Declare Function GBGetDiskSizeL Lib "GBLIB1c.DLL" ( ByVal sz_DriveLetter as String) as Long

Visual Basic Example

Print "Drive C has " & Format$( GBGetDiskSizeL("C" ), "###,###,##0") & " free. "

Print "Drive D has " & Format$( GBGetDiskSizeL("D" ), "###,###,##0") & " free. "

See...	GBGetDiskSizeS , GBGetDiskFreeS , GBGetDiskSizeL


GBIsFileInPath

 (or ALT+x)

Purpose

If the filename is in the DOS path, then this function returns 0, else it returns 1. The Windows path is not searched.

GBLIB1c.DLL Pascal Prototype

Function GBIsFileInPath ( sz_Filename : LPSTR) : INT ;Export;

Visual Basic Declare

Declare Function GBIsFileInPath Lib "GBLIB1c.DLL" (ByVal sz_Filename as String) as Integer

Visual Basic Example

If GBIsFileInPath ("wierdapp.exe") = 0 then

i_RetVal = Shell ("wierdapp.exe" , 0)

Else

Print "WIERDAPP.EXE is not in your DOS Path! "

End If


EncodeSingle

 (or ALT+x)

Purpose

This Subroutine will read a disk file, and encrypt it using your pass-phrase as a key. It will then write the encrypted file back to disk. (The original file will not be overwritten if you specify a different filename for the encrypted file)

The file can be as large as the available memory on the host machine. (Usually up to 4MB)

The encrypted file stores the original filename internally, so the encrypted filename can be anything you like.  The DecodeSingle  function will retrieve it.

Be sure to remember the Pass Phrase, as the file, once encrypted, cannot be retrieved without it!

GBLIB1c.DLL Pascal Prototype

Procedure EncodeSingle ( sz_InFilePath, sz_OutFilePath, sz_Phrase : LPSTR) ;Export;

Visual Basic Declare

Declare Sub EncodeSingle Lib "GBLIB1c.DLL" (ByVal sz_InFilePath as String, ByVal sz_OutFilePath as String, ByVal sz_PassPhrase as String)

Visual Basic Example

EncodeSingle "C:\AUTOEXEC.BAT", "C:\MYDIR\ENCODED.ENC", "In the name of all that does not suck"

See...	DecodeSingle function.


DecodeSingle

 (or ALT+x)

Purpose

This function decrypts a file that has previously encrypted with EncodeSingle .

Note that only the directory path need be specified for the destination. (The filename is stored in the encrypted file) The encrypted file is not deleted.

The Pass-Phrase must be identical with the one used to Encrypt the file.  Files can be as large as available memory.

Returns  Zero=Success, NonZero = Failure

GBLIB1c.DLL Pascal Prototype

Function DecodeSingle ( sz_InFilePath, sz_OutFileDir, sz_Phrase :LPSTR) :INT ;Export;

Visual Basic Declare

Declare Function DecodeSingle Lib "GBLIB1c.DLL" (ByVal sz_InFilePath as String, ByVal sz_OutFileDir as String, ByVal sz_PassPhrase as String) As Integer

Visual Basic Example

Dim i_RetVal as Integer

i_RetVal = DecodeSingle "C:\MYDIR\ENCODED.ENC", "C:\", "In the name of all that does not suck"

See...	EncodeSingle  function.


GetNumColours

 (or ALT+x)

Purpose

A simple function to return the number of colours available on the User"s screen display.

GBLIB1c.DLL Pascal Prototype

Function GetNumColours :LONGINT ;Export;

Visual Basic Declare

Declare Function GetNumColours Lib "GBLIB1c.DLL" () As Long

Visual Basic Example

Print "The number of colours available on your display are " & Format$(GetNumColours(),"##,###,##0")


DisableMouse

 (or ALT+x)

Purpose

This routine will remove the cursor from the screen, and COMPLETELY DISABLE any input from the user, whether mouse, keyboard, printer or com port.  Call EnableMouse  to restore normality

GBLIB1c.DLL Pascal Prototype

Procedure DisableMouse;export;

Visual Basic Declare

Declare Sub DisableMouse Lib "GBLIB1c.DLL" ()

Visual Basic Example

DisableMouse

... Do some stuff ...

EnableMouse

See...	EnableMouse function.


EnableMouse

 (or ALT+x)

Purpose

After a call to DisableMouse, this routine will restore normality.

GBLIB1c.DLL Pascal Prototype

Procedure EnableMouse;export;

Visual Basic Declare

Declare Sub EnableMouse Lib "GBLIB1c.DLL" ()

Visual Basic Example

DisableMouse

... Do some stuff ...

EnableMouse

See...	DisableMouse function.


GetJoyPos

 (or ALT+x)

Purpose

If the joystick functions are enabled, this routine retrieves the position and state of the buttons at any time

GBLIB1c.DLL Pascal Prototype

Function GetJoyPos ( var Xpos, Ypos, Zpos, Button1, Button2 : Integer) : Integer; Export;

Visual Basic Declare

Declare Function GetJoyPos Lib "GBLIB1c.DLL" (XPos As Integer, YPos As Integer, ZPos As Integer, Button1 As Integer, Button2 As Integer) As Integer

Visual Basic Example

Dim i_RetVal As Integer

Dim Xpos As Integer

Dim Ypos As Integer

Dim Zpos As Integer

Dim Button1 As Integer

Dim Button2 As Integer

SetUpJoyStick Me.hWnd

i_RetVal = GetJoyPos (Xpos, Ypos, Zpos, Button1, Button2)

UnSetUpJoyStick

See...	SetUpJoyStick   UnSetUpJoyStick  functions.


RegisterAppExt

 (or ALT+x)

Purpose

This function allows you to use the Windows Registration Database.

Using RegisterAppExt to register a filename extension to your application means that if a user double-clicks a filename with that extension in File Manager, Windows will automatically start your application, and pass it the filename as a parameter. Your application then picks it up via the COMMAND$ variable.

It is equivalent to using the "Associate With" command on the File Managers File menu.

If you wish to check the registration, run REGEDIT.EXE with the parameter "/v"

GBLIB1c.DLL Pascal Prototype

Function RegisterAppExt (sz_AppPath, sz_Ext:PChar) : Integer; Export;

Visual Basic Declare

Declare Function RegisterAppExt Lib "GBLIB1c.DLL" (ByVal sz_AppPath As String, ByVal sz_ExtNoDot As String) As Integer

Visual Basic Example

Dim i_RetVal As Integer

Dim sz_App As String

'	//Use the current Application//

sz_App = App.Path & "\" & App.EXEName & ".EXE"

'	//Register the extension "WAV" with this application//

sz_Ext = "WAV"

i_RetVal = RegisterAppExt(sz_App, sz_Ext)

If i_RetVal = 1 Then MsgBox "UnSuccessful", 48, "RegisterOpen"

Processing COMMAND$

Sub Form_Load

ProcessCommandString Command$

End Sub

Sub ProcessCommandString ( sz As String)

Dim sz_Ext As String

Dim i_Pos As Integer

'	//Is Command$ empty? If so, exit now//

If Len(sz) = 0 Then Exit Sub

'	//Is it a print item?//

i_Pos = InStr(1, sz, "/p")

If i_Pos > 0 Then

sz_Ext = Mid$(sz, i_Pos + 2)

'//sz_Ext is the file to be printed//

'//Call print code here//

End

Exit Sub

End If

'	//Deal with other parameters here//

'	//Is it a file? If not, then exit now//

i_Pos = InStr(1, sz, ".")

If i_Pos = 0 Then Exit Sub

'	//Get a copy of the File Extension//

sz_Ext = Mid$(sz, i_Pos + 1)

'	//sz is the filename to be processed//

'	//sz_Ext is its extension//

'	//Use a SELECT CASE to weed out the ones we are interested in//

Select Case UCase$(sz_Ext)

Case "WAV"

PlaySound sz

MsgBox sz & " - played by " & App.EXEName & ".EXE", 64, "Registration via GBLIB1c.DLL"

End

Case "TXT"

'	//Code to process TXT files here//

End Select

End Sub

See...
RegisterAppPrintExt
UnRegisterAppExt
UnRegisterAppPrintExt
UnRegisterAll


RegisterAppPrintExt

 (or ALT+x)

Purpose

This function allows you to use the Windows Registration Database.

Using RegisterAppPrintExt to register a filename extension to your application means that if a user drags a file with your registered extension and drops it on Print Manager, Windows will start your application and pass it the filename (preceded by the string "/p ")  Your application, using COMMAND$, can detect the "/p ", and process the filename that follows accordingly.

If you wish to check the registration, run REGEDIT.EXE with the parameter "/v"

GBLIB1c.DLL Pascal Prototype

Function RegisterAppPrintExt (sz_AppPath, sz_Ext:PChar) : Integer; Export;

Visual Basic Declare

Declare Function RegisterAppPrintExt Lib "GBLIB1c.DLL" (ByVal sz_AppPath As String, ByVal sz_ExtNoDot As String) As Integer

Visual Basic Example

Dim i_RetVal As Integer

Dim sz_App As String

'	//Use the current Application//

sz_App = App.Path & "\" & App.EXEName & ".EXE"

'	//Register the extension "PRN" with this application//

sz_Ext = "PRN"

i_RetVal = RegisterAppPrintExt(sz_App, sz_Ext)

If i_RetVal = 1 Then MsgBox "UnSuccessful", 48, "RegisterPrint"

Processing COMMAND$

Sub Form_Load

ProcessCommandString Command$

End Sub

Sub ProcessCommandString ( sz As String)

Dim sz_Ext As String

Dim i_Pos As Integer

'	//Is Command$ empty? If so, exit now//

If Len(sz) = 0 Then Exit Sub

'	//Is it a print item?//

i_Pos = InStr(1, sz, "/p")

If i_Pos > 0 Then

sz_Ext = Mid$(sz, i_Pos + 2)

'//sz_Ext is the file to be printed//

'//Call print code here//

End

Exit Sub

End If

'	//Deal with other parameters here//

'	//Is it a file? If not, then exit now//

i_Pos = InStr(1, sz, ".")

If i_Pos = 0 Then Exit Sub

'	//Get a copy of the File Extension//

sz_Ext = Mid$(sz, i_Pos + 1)

'	//sz is the filename to be processed//

'	//sz_Ext is its extension//

'	//Use a SELECT CASE to weed out the ones we are interested in//

Select Case UCase$(sz_Ext)

Case "WAV"

PlaySound sz

MsgBox sz & " - played by " & App.EXEName & ".EXE", 64, "Registration via GBLIB1c.DLL"

End

Case "TXT"

'	//Code to process TXT files here//

End Select

End Sub

See...
RegisterAppExt
UnRegisterAppExt
UnRegisterAppPrintExt
UnRegisterAll


UnRegisterAppExt

 (or ALT+x)

Purpose

If you wish to Unregister your file extension from your application for opening, but wish to leave the printing (and any OLE) registration alone, then use this.

It will delete the //open/command=  entry.

GBLIB1c.DLL Pascal Prototype

Function UnRegisterAppExt (sz_Ext:PChar) : Integer; Export;

Visual Basic Declare

Declare Function UnRegisterAppExt Lib "GBLIB1c.DLL" (ByVal sz_ExtNoDot As String) As Integer

Visual Basic Example

Dim i_RetVal As Integer

i_RetVal = UnRegisterAppExt ( "WAV" )

If i_RetVal = 1 then MsgBox "Unsuccessful", 48, "UnregisterAppExt"

See...
RegisterAppExt
RegisterAppPrintExt
UnRegisterAppPrintExt
UnRegisterAll


UnRegisterAppPrintExt

 (or ALT+x)

Purpose

If you wish to Unregister your file extension from your application for printing, but wish to leave the opening (and any OLE) registration alone, then use this.

It will delete the //print/command=  entry.

GBLIB1c.DLL Pascal Prototype

Function UnRegisterAppPrintExt (sz_Ext:PChar) : Integer; Export;

Visual Basic Declare

Declare Function UnRegisterAppPrintExt Lib "GBLIB1c.DLL" (ByVal sz_ExtNoDot As String) As Integer

Visual Basic Example

Dim i_RetVal As Integer

i_RetVal = UnRegisterAppPrintExt ( "PRN" )

If i_RetVal = 1 then MsgBox "Unsuccessful", 48, "UnregisterAppPrintExt"

See...
RegisterAppExt
RegisterAppPrintExt
UnRegisterAppExt
UnRegisterAll


UnRegisterAll

 (or ALT+x)

Purpose

This will delete the whole entry in the Registration Database that is associated with the passed extension.  Use with care!

GBLIB1c.DLL Pascal Prototype

Function UnRegisterAll (sz_Ext:PChar) : Integer; Export;

Visual Basic Declare

Declare Function UnRegisterAll Lib "GBLIB1c.DLL" (ByVal sz_ExtNoDot As String) As Integer

Visual Basic Example

Dim i_RetVal As Integer

i_RetVal = UnRegisterAll ( "WAV" )

If i_RetVal = 1 then MsgBox "Unsuccessful", 48, "UnregisterAll"

See...
RegisterAppExt
RegisterAppPrintExt
UnRegisterAppExt
UnRegisterAppPrintExt


Changes and Bug-Fixes

 (or ALT+x)

This section is to incorporate any future changes or bug-fixes to the GBLIB1 project.

Updates to this help file and previous help files are accessed by the jumps below.

Each jump item accesses a past or future help file that has the same name as the highlighted text.

If there is no corresponding GBLIB1x.HLP file in your WINDOWS directory, then an error ( "Cannot open Help file" ) will be shown instead.

CLICK ME FOR GBLIB1.HLP

CLICK ME FOR GBLIB1a.HLP

CLICK ME FOR UPDATES IN GBLIB1d.HLP

CLICK ME FOR UPDATES IN GBLIB1e.HLP

CLICK ME FOR UPDATES IN GBLIB1f.HLP

CLICK ME FOR UPDATES IN GBLIB1g.HLP


Whats new from GBLIB1a?

 (or ALT+x)

New Registration Functions!

RegisterAppExt 	Index 99

RegisterAppPrintExt 	Index 100

UnRegisterAppExt  	Index 101

UnRegisterAppPrintExt 	Index 102

UnRegisterAll 	Index 103

1) The result of Using RegisterAppExt with your Application

If the user opens File Manager, and double-clicks a file with the extension you have specified, then Windows will open your application and pass the filename to it as a parameter.

Your application can pick it up in COMMAND$ and process it accordingly.

2) The result of Using RegisterAppPrintExt with your Application

If the user drags the file with the extension you have specified, and drops it into Print Manager, then Windows will open your application, and pass the filename to it as a parameter, with a /p prefix.

Your application can pick it up in COMMAND$ and process it accordingly.(remember to remove the /p)

3) UnRegistering

If you have registered using BOTH functions, and you ONLY want to unregister ONE function, then use the appropriate unregister function.

Note: To remove registration information for the extension completely, you MUST use the UnregisterAll function.

Picture Property can now be set in Bitmap and Icon functions

This has to be done partly by GBLIB1c, and partly by your Visual Basic code.

Here is the bit you have to do (or use the wrapper functions in GBLIB1c.BAS)

1) AutoRedraw for the control must be set to TRUE

2) Call the DLL function.

3) After the DLL call, set the Picture property to the Image property.

That's it!

EnableMouse/DisableMouse

DisableMouse 	Index 96

EnableMouse 	Index 97

After DisableMouse, the cursor is made invisible.

A call to EnableMouse restores it.

GetJoyPos

GetJoyPos 	Index 98

Used with SetUpJoystick  function, the joystick can now be polled as required.

Thank you for supporting the GBLIB project.

- Gordon Bamber  30/04/95